package com.situ.mall.web.controller;

import com.situ.mall.common.service.IProductService;
import com.situ.mall.common.vo.IntroductionProductVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/product")
public class ProductController {

    @Autowired
    private IProductService productService;

    @GetMapping("/{id}")
    public String product(@PathVariable Integer id, Model model){

        List<IntroductionProductVO> vo = productService.introductionProduct(id);

        model.addAttribute("introductionProduct1",vo);

        return "introduction";
    }
}
